<template>
  <view class="main-box">
    <view class="img-container">
      <image
        style="height: 510rpx; width: 750rpx"
        model="scaleToFill"
        src="/static/images/bgc_01.png"
      ></image>
    </view>
    <view class="edit-box">
      <view class="my-date">
        <view class="my-date-input">
          <view style="margin-right:20rpx">{{ valueTime }}</view>
          <view>星期{{ weekArray[new Date(valueTime).getDay()] }}</view>
        </view>
        <view class="my-date-select">
          <picker
            @change="bindPickerChange"
            :value="index"
            :range="userList"
            :range-key="'userName'"
          >
            <view class="userSelectEnd" style="font-size: 26rpx;line-height:40rpx">
              <view  style="margin-right: 20rpx;">
                {{ userList[index] ? userList[index].userName : '' }}
              </view>
              <u-image              
                width="40rpx"
                height="40rpx"
                src="/static/images/down.png"
              ></u-image
            ></view>
          </picker>
        </view>
      </view>
      <view style="margin: 0 30rpx; ">
        <view class="my-uni-form">
          <view>
            <input
              v-model="form.content1"
              @blur="
                setCache('content1_' + selectUserObj.userId, form.content1)
              "
              @input="hasSubmit"
              class="uni-input"
              placeholder-style="color:#DBDBDB;"
              placeholder="工作一最多输入120个字"
              maxlength="120"
              type="text"
            />
           <!-- <textarea
              @blur="
                setCache('describe1_' + selectUserObj.userId, form.describe1)
              "
              v-model="form.describe1"
              class="uni-textarea"
              placeholder-style="color:#DBDBDB;"
            /> -->
            <cmpVideo
              :fileList="fileList"
              @changeComponentData="changeComponentData"
            />
          </view>
          <view>
            <input
              v-model="form.content2"
              @blur="
                setCache('content2_' + selectUserObj.userId, form.content2)
              "
              @input="hasSubmit"
              class="uni-input"
              placeholder="工作二最多输入120个字"
              placeholder-style="color:#DBDBDB;"
              maxlength="120"
              type="text"
            />
            <!-- <textarea
              v-model="form.describe2"
              @blur="
                setCache('describe2_' + selectUserObj.userId, form.describe2)
              "
              class="uni-textarea"
            /> -->
            <cmpVideo
              :fileList="fileList1"
              @changeComponentData="changeComponent1Data"
            />
          </view>
          <view style="margin-bottom: 140rpx">
            <input
              v-model="form.content3"
              @input="hasSubmit"
              @blur="
                setCache('content3_' + selectUserObj.userId, form.content3)
              "
              class="uni-input"
              placeholder="工作三最多输入120个字"
              placeholder-style="color:#DBDBDB;"
              maxlength="120"
              type="text"
            />
            <!-- <textarea
              v-model="form.describe3"
              @blur="
                setCache('describe3_' + selectUserObj.userId, form.describe3)
              "
              class="uni-textarea"
            /> -->
            <cmpVideo
              :fileList="fileList2"
              @changeComponentData="changeComponent2Data"
            />
          </view>
        </view>
        <u-datetime-picker
          :show="timeShow"
          @cancel="timeCancel"
          @confirm="timeConfirm"
          v-model="value1"
          mode="date"
        ></u-datetime-picker>
        <u-modal :show="show" width="690rpx" :showConfirmButton="false">
          <cmpDialog
            v-if="btnStatus === 2"
            @handleClose="handleClose"
            @submitForm="submitDocumentForm"
            :dialogData="dialogForwardDocumentData"
          />
          <cmpDialog
            v-if="btnStatus === 1"
            @handleClose="handleClose"
            @submitForm="submitOwnForm"
            :dialogData="dialogOwnData"
          />
        </u-modal>
      </view>
      <view class="submit-form">
        <u-button
          @click="submit"
         :disabled="statuS == 1"
          :customStyle="{
            boxShadow: 'none !important',
            width: '40%',
            borderRadius: '10rpx',
            color: '#FFFFFF',
            border: '1px solid #0C347E',
            background: '#0C347E',
          }"
          >提交</u-button
        >
        <u-button
          @click="toLeader"
            :disabled="statuS == 1"
          :customStyle="{
            boxShadow: 'none !important',
            width: '40%',
            borderRadius: '10Rpx',
            color: '#0C347E',
            border: '1px solid #0C347E',
            background: '#F5F5F5',
          }"
          >转发领导</u-button
        >
      </view>
    </view>
  </view>
</template>
<script>
import cmpDialog from '../../components/cmp-dialog.vue'
import cmpVideo from '../../../components/cmp-video.vue'
import {
  setDailyWrite,
  getSelectLeadersList,
  setMessageData,
  getDailyByClerkFun,
  getSelectDailyByUserId
} from '@/service/services.js'
import { mapState } from 'vuex'
import moment from 'moment'
export default {
  data() {
    return {
      statuS:0,//控制按钮功能
      index: 0,
      submitStatus: null,
      submitStatusObj: {},
      btnStatus: 1,
      show: false,
      weekArray: ['日', '一', '二', '三', '四', '五', '六'],
      imageValue: [],
      userList: [],
      valueTime: moment(new Date()).format('YYYY-MM-DD'),
      timeShow: false,
      pupDocumentShow: false,
      selectShow: false,
      selectUserObj: {},
      pupOwnShow: false,
      selectValue: '请选择',
      value: moment(new Date()).format('YYYY-MM-DD'),
      value1: moment(new Date()).format('YYYY-MM-DD'),
      dialogOwnData: {
        title: '是否对修改内容进行提交？',
        btn: {
          ok: '提交',
          close: '暂不',
        },
      },
      dialogOwnData: {
        title: '是否对编辑内容进行提交？',
        btn: {
          ok: '提交',
          close: '暂不',
        },
      },
      dialogForwardDocumentData: {
        title: '是否将文件转发给领导？',
        btn: {
          ok: '转发',
          close: '暂不',
        },
      },
      fileList: [],
      fileList1: [],
      fileList2: [],
      form: {
        content1: '',
        file1: '',
        content2: '',
        file2: '',
        content3: '',
        file3: '',
      },
      value: '',
      writeDailyData: {
        title: '写日报',
        info: '编辑当日日报',
        count: 200,
      },
      editDailyData: {
        title: '改日报',
        info: '修改文书提交日报',
        count: 4,
      },
    }
  },
  computed: mapState({
    userInfo(item) {
      return item.userInfo
    },
  }),
  onHide() {},
  onLoad() {
    this.userList = []
    getSelectLeadersList({
      userId: this.userInfo.userId,
    }).then((res) => {
      const arr = res.data
      this.selectUserObj = arr[0]
      this.userList = res.data
        //进来判断第一个领导的状态
       getSelectDailyByUserId({
        leaderid:this.userList[this.index].userId,
        clerkid: this.userInfo.userId,
        createBy: this.userInfo.userId,
        createDate: moment(new Date()).format('YYYY-MM-DD'),
     }).then(res =>{
        if(res.data.length>0){
          this.statuS=1
       } 
       else  this.statuS=0
     }) 
      
      uni.getStorage({
        key: 'describe1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe1 = res.data
            } else {
              this.form.describe1 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'describe2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe2 = res.data
            } else {
              this.form.describe2 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'describe3_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe3_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe3 = res.data
            } else {
              this.form.describe3 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content1 = res.data
            } else {
              this.form.content1 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content2 = res.data
            } else {
              this.form.content2 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content3_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content3_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content3 = res.data
            } else {
              this.form.content3 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList = res.data
            } else {
              this.fileList = []
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList1 = res.data
            } else {
              this.fileList1 = []
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList2 = res.data
            } else {
              this.fileList2 = []
            }
          }
        },
      })
   
     getDailyByClerkFun({   
        leaderid :this.selectUserObj.userId,
        clerkid: this.userInfo.userId,//this.selectUserObj.userId,
        createBy: this.userInfo.userId,
        createDate: moment(new Date()).format('YYYY-MM-DD'),
      }).then((res) => {     
        this.submitStatusObj = res.data
      })
    })
    wx.setVisualEffectOnCapture({
      visualEffect: 'hidden',
    })
  },
  methods: {
     deleteEndPunctuation(str){
       for(let i=1;i<str.length;i++){
          let lastIndex=  str.charAt(str.length-i) 
          let flag =  lastIndex.replace(/(.*)(，|。|、|！|；|,|;|!)/g ,"") 
            if(flag){       
            return  str.slice(0,str.length-i+1)   
            }
        }
      },
    hasSubmit(){
      if(this.statuS===1){
        uni.showToast({
                      title: '当日日报已被处理，无需重复操作',
                      type: 'default',                   
                      icon: 'none',
                      position: 'center',
                      mask: true,
                      duration: 2000,
                 })
      }
    },
    submit(){          
         if (!this.form.content1){
                  uni.showToast({
                      title: '工作一内容不能为空',
                      type: 'default',                   
                      icon: 'none',
                      position: 'center',
                      mask: true,
                      duration: 2000,
                 })
                return
         }  
             this.btnStatus = 1
              this.show = true          
    },
    toLeader(){
              if (!this.form.content1){
                  uni.showToast({
                      title: '工作一内容不能为空',
                      type: 'default',                   
                      icon: 'none',
                      position: 'center',
                      mask: true,
                      duration: 2000,
                 })
                return
         }  
             this.btnStatus = 2
              this.show = true   
    },
    bindPickerChange(e) {
      this.index = e.target.value
      this.selectUserObj = this.userList[e.target.value]
  
      uni.getStorageInfo({
        success: (res) => {
          const filter1 = res.keys.includes(
            'describe1_' + this.selectUserObj.userId
          )
          if (!filter1) {
            this.form.describe1 = ''
          }
          const filter2 = res.keys.includes(
            'describe2_' + this.selectUserObj.userId
          )
          if (!filter2) {
            this.form.describe2 = ''
          }
          const filter3 = res.keys.includes(
            'describe3_' + this.selectUserObj.userId
          )
          if (!filter3) {
            this.form.describe3 = ''
          }
          const content1 = res.keys.includes(
            'content1_' + this.selectUserObj.userId
          )
          if (!content1) {
            this.form.content1 = ''
          }
          const content2 = res.keys.includes(
            'content2_' + this.selectUserObj.userId
          )
          if (!content2) {
            this.form.content2 = ''
          }
          const content3 = res.keys.includes(
            'content3_' + this.selectUserObj.userId
          )
          if (!content3) {
            this.form.content3 = ''
          }
          const fileList = res.keys.includes(
            'fileList_' + this.selectUserObj.userId
          )
          if (!fileList) {
            this.fileList = []
          }
          const fileList1 = res.keys.includes(
            'fileList1_' + this.selectUserObj.userId
          )
          if (!fileList1) {
            this.fileList1 = []
          }
          const fileList2 = res.keys.includes(
            'fileList2_' + this.selectUserObj.userId
          )
          if (!fileList2) {
            this.fileList2 = []
          }
        },
      })
   
      //选择器-----------------------
     getSelectDailyByUserId({
        leaderid:this.userList[this.index].userId,
        clerkid: this.userInfo.userId,
        createBy: this.userInfo.userId,
        createDate: moment(new Date()).format('YYYY-MM-DD'),
     }).then(res =>{
         if(res.data.length>0){
          this.statuS=1
       } 
       else  this.statuS=0     
     })
      getDailyByClerkFun({
        clerkid: this.userInfo.userId,
        createBy: this.userInfo.userId,
        createDate: moment(new Date()).format('YYYY-MM-DD'),
      }).then((res) => {
        this.submitStatusObj = res.data
        uni.getStorage({
          key: 'describe1_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('describe1_' + this.selectUserObj.userId).split(
                '_'
              )[1]
              if (id == this.selectUserObj.userId) {
                this.form.describe1 = res.data
              } else {
                this.form.describe1 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'describe2_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('describe2_' + this.selectUserObj.userId).split(
                '_'
              )[1]
              if (id == this.selectUserObj.userId) {
                this.form.describe2 = res.data
              } else {
                this.form.describe2 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'describe3_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('describe3_' + this.selectUserObj.userId).split(
                '_'
              )[1]
              if (id == this.selectUserObj.userId) {
                this.form.describe3 = res.data
              } else {
                this.form.describe3 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'content1_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('content1_' + this.selectUserObj.userId).split('_')[1]
              if (id == this.selectUserObj.userId) {
                this.form.content1 = res.data
              } else {
                this.form.content1 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'content2_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('content2_' + this.selectUserObj.userId).split('_')[1]
              if (id == this.selectUserObj.userId) {
                this.form.content2 = res.data
              } else {
                this.form.content2 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'content3_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('content3_' + this.selectUserObj.userId).split('_')[1]
              if (id == this.selectUserObj.userId) {
                this.form.content3 = res.data
              } else {
                this.form.content3 = ''
              }
            }
          },
        })
        uni.getStorage({
          key: 'fileList_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('fileList_' + this.selectUserObj.userId).split('_')[1]
              if (id == this.selectUserObj.userId) {
                this.fileList = res.data
              } else {
                this.fileList = []
              }
            }
          },
        })
        uni.getStorage({
          key: 'fileList1_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('fileList1_' + this.selectUserObj.userId).split(
                '_'
              )[1]
              if (id == this.selectUserObj.userId) {
                this.fileList1 = res.data
              } else {
                this.fileList1 = []
              }
            }
          },
        })
        uni.getStorage({
          key: 'fileList2_' + this.selectUserObj.userId,
          success: (res) => {
            if (res) {
              const id = ('fileList2_' + this.selectUserObj.userId).split(
                '_'
              )[1]
              if (id == this.selectUserObj.userId) {
                this.fileList2 = res.data
              } else {
                this.fileList2 = []
              }
            }
          },
        })
      })
    },
    setCache(key, content) {
      uni.setStorage({
        key: key,
        data: content,
      })     
    },
    changeTimeDate(timeData) {
      return moment(timeData).format('YYYY-MM-DD')
    },
    changeComponentData(data) {
      this.fileList = data
      this.setCache('fileList_' + this.selectUserObj.userId, data)
    },
    changeComponent1Data(data) {
      this.fileList1 = data
      this.setCache('fileList1_' + this.selectUserObj.userId, data)
    },
    changeComponent2Data(data) {
      this.fileList2 = data
      this.setCache('fileList2_' + this.selectUserObj.userId, data)
    },
    submitDocumentForm() {
      this.form.file1 = ''
      this.form.file2 = ''
      this.form.file3 = ''
   
      if (this.fileList.length > 0) {
        this.fileList.forEach((item) => {
          this.form.file1 += item.fileUrl + ';'
        })
      }
      if (this.fileList1.length > 0) {
        this.fileList1.forEach((item) => {
          this.form.file2 += item.fileUrl + ';'
        })
      }
      if (this.fileList2.length > 0) {
        this.fileList2.forEach((item) => {
          this.form.file3 += item.fileUrl + ';'
        })
      }
      setDailyWrite({
        content1: this.form.content1,
        file1: this.form.file1,
        content2: this.form.content2,
        file2: this.form.file2,
        content3: this.form.content3,
        file3: this.form.file3,
        createBy: this.userInfo.userId,
        clerkid: this.userInfo.userId,
        leaderid: this.selectUserObj.userId,
        flag: 0,
        describe1: this.form.describe1,
        describe2: this.form.describe2,
        describe3: this.form.describe3,
      })
        .then((res) => {
          setMessageData({
            type: 4,
            leaderid: this.selectUserObj.userId,
            clerkid: this.userInfo.userId,
          })
          uni.showToast({
            title: '已处理',
            type: 'default',
            position: 'bottom',
            icon: 'none',
            position: 'center',
            mask: true,
            duration: 3000,
          })
          uni.removeStorage({ key: 'fileList_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'fileList1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'fileList2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content3_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe3_' + this.selectUserObj.userId })
          uni.switchTab({
            url: '/pages/secretary-daily/daily-edit-home/index',
          })
          this.show = false
        })
        .catch(() => {
          this.show = false
        })
    },
    handleForward() {
      this.pupDocumentShow = true
    },
    timeCancel() {
      this.timeShow = false
    },
    timeConfirm(e) {
      this.valueTime = this.changeTimeDate(e.value)
      this.timeShow = false
    },
    handleOtherSelectClose() {
      this.selectShow = false
    },
    handleOtherSelectSubmit(e) {
      this.selectShow = false
      this.selectValue = e.value[0].label
      this.selectUserObj = {
        status: e.value[0].status,
        label: e.value[0].label,
        id: e.value[0].id,
      }
      const _that = this
      uni.getStorageInfo({
        success: (res) => {
          const filter1 = res.keys.includes(
            'describe1_' + this.selectUserObj.userId
          )
          if (!filter1) {
            this.form.describe1 = ''
          }
          const filter2 = res.keys.includes(
            'describe2_' + this.selectUserObj.userId
          )
          if (!filter2) {
            this.form.describe2 = ''
          }
          const filter3 = res.keys.includes(
            'describe3_' + this.selectUserObj.userId
          )
          if (!filter3) {
            this.form.describe3 = ''
          }
          const content1 = res.keys.includes(
            'content1_' + this.selectUserObj.userId
          )
          if (!content1) {
            this.form.content1 = ''
          }
          const content2 = res.keys.includes(
            'content2_' + this.selectUserObj.userId
          )
          if (!content2) {
            this.form.content2 = ''
          }
          const content3 = res.keys.includes(
            'content3_' + this.selectUserObj.userId
          )
          if (!content3) {
            this.form.content3 = ''
          }
          const fileList = res.keys.includes(
            'fileList_' + this.selectUserObj.userId
          )
          if (!fileList) {
            this.fileList = []
          }
          const fileList1 = res.keys.includes(
            'fileList1_' + this.selectUserObj.userId
          )
          if (!fileList1) {
            this.fileList1 = []
          }
          const fileList2 = res.keys.includes(
            'fileList2_' + this.selectUserObj.userId
          )
          if (!fileList2) {
            this.fileList2 = []
          }
        },
      })
      uni.getStorage({
        key: 'describe1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe1 = res.data
            } else {
              this.form.describe1 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'describe2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe2 = res.data
            } else {
              this.form.describe2 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'describe3_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('describe3_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.describe3 = res.data
            } else {
              this.form.describe3 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content1 = res.data
            } else {
              this.form.content1 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content2 = res.data
            } else {
              this.form.content2 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'content3_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('content3_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.form.content3 = res.data
            } else {
              this.form.content3 = ''
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList = res.data
            } else {
              this.fileList = []
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList1_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList1_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList1 = res.data
            } else {
              this.fileList1 = []
            }
          }
        },
      })
      uni.getStorage({
        key: 'fileList2_' + this.selectUserObj.userId,
        success: (res) => {
          if (res) {
            const id = ('fileList2_' + this.selectUserObj.userId).split('_')[1]
            if (id == this.selectUserObj.userId) {
              this.fileList2 = res.data
            } else {
              this.fileList2 = []
            }
          }
        },
      })
      getDailyByClerkFun({
        clerkid: this.userInfo.userId,
        createBy: this.userInfo.userId,
        createDate: moment(new Date()).format('YYYY-MM-DD'),
      }).then((res) => {
        this.submitStatusObj = res.data
      })
    },
    change() {
      this.timeShow = true
    },
    handleSelect() {
      this.selectShow = true
    },
    handleClose() {
      this.show = false
    },
    submitOwnForm() {
      this.form.file1 = ''
      this.form.file2 = ''
      this.form.file3 = ''
       //去掉文本输入最后一个标点符号
      if(this.form.content1){
          this.form.content1 = this.deleteEndPunctuation(this.form.content1)
       }
      if(this.form.content2){
         this.form.content2 = this.deleteEndPunctuation(this.form.content2)
       }
      if(this.form.content3){
          this.form.content3 =this.deleteEndPunctuation(this.form.content3)
       }
      if (this.fileList.length > 0) {
        this.fileList.forEach((item) => {
          this.form.file1 += item.fileUrl + ';'
        })
      }
      if (this.fileList1.length > 0) {
        this.fileList1.forEach((item) => {
          this.form.file2 += item.fileUrl + ';'
        })
      }
      if (this.fileList2.length > 0) {
        this.fileList2.forEach((item) => {
          this.form.file3 += item.fileUrl + ';'
        })
      }
      setDailyWrite({
        content1: this.form.content1,
        file1: this.form.file1,
        content2: this.form.content2,
        file2: this.form.file2,
        content3: this.form.content3,
        file3: this.form.file3,
        describe1: this.form.describe1,
        describe2: this.form.describe2,
        describe3: this.form.describe3,
        createBy: this.userInfo.userId,
        clerkid: this.userInfo.userId,
        leaderid: this.selectUserObj.userId,
        status: 0,
      })
        .then((res) => {
          uni.removeStorage({ key: 'fileList_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'fileList1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'fileList2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'content3_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe1_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe2_' + this.selectUserObj.userId })
          uni.removeStorage({ key: 'describe3_' + this.selectUserObj.userId })
          uni.showToast({
            title: '已处理',
            type: 'default',
            position: 'bottom',
            icon: 'none',
            position: 'center',
            mask: true,
            duration: 3000,
          })
          setMessageData({
            type: 2,
            leaderid: this.selectUserObj.userId,
            clerkid: this.userInfo.userId,
          })
          this.show = false
          setTimeout(() => {
            uni.switchTab({
              url: '/pages/secretary-daily/daily-edit-home/index',
              success: (info) => {},
            })
          }, 3000)
        })
        .catch(() => {
          this.show = false
        })
    },
  },
  components: {
    cmpDialog,
    cmpVideo,
  },
}
</script>

<style lang="scss" scoped>
.my-date {
  padding-left:30rpx;
  display: flex;
  align-items: center;
  position: relative;
  height: 90rpx;
  background: #05163E;
  box-shadow: 0px 3rpx 2rpx 0px hsl(219, 100%, 89%);
  border-radius: 10rpx 10rpx 0px 0px;
  justify-content: space-between;
  .my-date-select {
    text-align: end;
    margin-right: 30rpx;
    color: #fff;
  }
  .userSelectEnd {
    display: flex;
  }
}
.edit-box {
  flex: 1;
  margin: 30rpx;
  background: #fff;
  z-index: 2;
  box-sizing: border-box;
  background: #fff;
  box-shadow: 0px 3rpx 8rpx 0px #b7a5a6;
  border-radius: 10rpx 10rpx 10rpx 10rpx;
  position: relative;
}
.main-box {
  width: 100%;
  display: flex;
  flex-direction: column;
  position: absolute;
  background-color: #f5f9ff;
}
.img-container {
  position: fixed;
  width: 100%;
}
.containerBody {
  .content {
    display: flex;
    flex: 1;
    justify-content: space-between;
    position: relative;
  }
  .warning-time {
    height: 100rpx;
    text-align: center;
    font-size: 24rpx;
    font-weight: 400;
    color: #606c81;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
  }
  .time {
    font-size: 48rpx;
    font-weight: bold;
    color: #14bfb1;
    margin: 0px 8rpx;
  }
  position: relative;
  flex: 1;
  margin: -60rpx 24rpx 24rpx 24rpx;
  box-sizing: border-box;
  border: 2rpx solid #ddd;
  z-index: 2;
  box-shadow: 0px 6rpx 6rpx 0rpx #c5adae;
  border-radius: 20rpx;
  background: #fff;
}
.bottomImg {
  height: 126rpx;
  border-radius: 10rpx;
  position: absolute;
  bottom: -6rpx;
  width: 100%;
}
.submit-form {
  bottom: 30rpx;
  display: flex;
  width: 100%;
  position: absolute;
}
</style>
